package com.zxw.设计模式.结构型.桥接模式.service.impl.划账;

import com.zxw.设计模式.结构型.桥接模式.service.IPayModel;
import com.zxw.设计模式.结构型.桥接模式.service.Pay;

import java.math.BigDecimal;

/**
 * @projectName: util-cloud
 * @package: com.zxw.设计模式.结构型.桥接模式.service.impl.划账
 * @className: WxPay
 * @author: zhangxuewei
 * @description: 微信支付
 * @date: 2023/6/26 17:53
 * @version: 1.0
 */
public class WxPay extends Pay {

    public WxPay(IPayModel payModel) {
        super(payModel);
    }

    /**
     * @param uId:
     * @param tradeId:
     * @param amount:  金额
     * @return String
     * @author zhangxuewei
     * @description 划账
     * @date 2023/6/26 17:53
     */
    @Override
    public String transfer(String uId, String tradeId, BigDecimal amount) {
        System.out.println("微信划账开始...");
        System.out.println("微信风险校验" + uId + "," + tradeId + "," + amount);
        boolean security = payModel.security(uId);
        if (!security) {
            System.out.println("存在风险！");
            return "500";
        }
        System.out.println("微信划账成功！金额：" + amount);
        return "200";
    }
}
